window.addEventListener('load', function () {
    var eye = document.getElementById('eye');
    var psw = document.getElementById('psw');
    var flag = 0;
    eye.onclick = function () {
        if (flag == 0) {
            psw.type = 'text';
            eye.src = 'images/open.png';
            flag = 1;
        } else {
            psw.type = 'password';
            eye.src = 'images/close.png';
            flag = 0;
        }
    }
    var message0 = document.querySelector('.message0');
    var ipone = document.getElementById('ipone');
    ipone.onblur = function () {
        if (this.value.length != 11) {
            message0.className = 'samemessage wrong';
            message0.innerHTML = '输入位数错误';
        } else {
            message0.className = 'samemessage right';
            message0.innerHTML = '输入正确';
        }
    }
    var message1 = document.querySelector('.message1');
    var xinxi = document.getElementById('xinxi');
    xinxi.onblur = function () {
        if (this.value.length != 6) {
            message1.className = 'samemessage wrong';
            message1.innerHTML = '输入位数错误';
        } else {
            message1.className = 'samemessage right';
            message1.innerHTML = '输入正确';
        }
    }
    var message2 = document.querySelector('.message2');
    psw.onblur = function () {
        if (this.value.length < 6 || this.value.length > 16) {
            message2.className = 'samemessage wrong';
            message2.innerHTML = '输入位数错误';
        } else {
            message2.className = 'samemessage right';
            message2.innerHTML = '输入正确';
        }
    }
    var message3 = document.querySelector('.message3');
    var psw2 = document.getElementById('psw2');
    psw2.onblur = function () {
        if (this.value != psw.value) {
            message3.className = 'samemessage wrong';
            message3.innerHTML = '密码不一致';
        } else {
            message3.className = 'samemessage right';
            message3.innerHTML = '输入正确';
        }
    }
})